package com.jrx.anytxn.investor.service.impl;

import com.jrx.anytxn.investor.bean.InvestorTransferBean;
import com.jrx.anytxn.investor.constant.TransBizConstant;
import com.jrx.anytxn.investor.service.IInvestorTransferMethodStrategy;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

/**
 * 发生额法转列策略
 * 
 * @author liuyang
 * @date 2020-05-28
 **/
@Order(0)
@Service
public class InvestorIncidenceTransferMethodStrategy implements IInvestorTransferMethodStrategy {


    /**
     * 发生额法账户外转列处理 会计状态升级，转非应计，五级分类升级
     *
     * @param transferBean 转列辅助Bean
     * @return InvestorTransferBean 转列辅助Bean
     * @author liuyang
     * @date 2020-05-28
     */
    @Override
    public InvestorTransferBean transferOut(InvestorTransferBean transferBean) {

        //当期延滞天数
        int delqDays = transferBean.getDelqDays();
        //订单最大延滞天数
        int delqMaxDays = transferBean.getMaxDelqDays();
        if(TransBizConstant.ACCOUNT_TYPE_05.equals(transferBean.getAccountType())){
            return transferBean.setAccountingDays(delqMaxDays).setNonAccrualDays(delqMaxDays).setClassifyDays(delqMaxDays);
        }else{
            return transferBean.setAccountingDays(delqDays).setNonAccrualDays(delqMaxDays).setClassifyDays(delqMaxDays);
        }
    }

    /**
     * 发生额法账户内转列处理 会计状态降级，转应计，五级分类降级
     *
     * @param transferBean 转列辅助Bean
     * @return InvestorTransferBean 转列辅助Bean
     * @author liuyang
     * @date 2020-05-28
     */
    @Override
    public InvestorTransferBean transferIn(InvestorTransferBean transferBean) {
        //当期延滞天数
        int delqDays = transferBean.getDelqDays();
        //订单最大延滞天数
        int delqMaxDays = transferBean.getMaxDelqDays();
        if(TransBizConstant.ACCOUNT_TYPE_05.equals(transferBean.getAccountType())){
            return transferBean.setAccountingDays(delqMaxDays).setNonAccrualDays(delqMaxDays).setClassifyDays(delqMaxDays);
        }else{
            return transferBean.setAccountingDays(delqDays).setNonAccrualDays(delqMaxDays).setClassifyDays(delqMaxDays);
        }
    }
}
